package com.ssslogin.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * Created with IntelliJ IDEA by ChouFy on 2020-03-11.
 *
 * @author zhoufy
 */
@Controller
@RequestMapping("/login")
public class LoginController {


    private final String username = "admin";
    private final String password = "admin";

    @RequestMapping("")
    public String login(HttpSession session, String username, String password, Map<String, Object> map) {

        if (!this.username.equals(username) || !this.password.equals(password)) {
            map.put("msg", "用户名或密码错误");
            return "index";
        }
        session.setAttribute("loginInfo", username + ":" + password);
        return "redirect:/resume/list";
    }
}
